<html>
<head>
    <title>登录中</title>
    <script type="text/javascript" src="https://login.luckydragon88.com/jswrapper/integration.js.php?casino=greatfortune88"></script>
    <script type="text/javascript">
        iapiSetCallout('Login', calloutLogin);

        function login() {
            iapiSetClientPlatform("mobile&deliveryPlatform=HTML5");
            var realMode = 1;
            iapiLogin("{!! $accountUserName !!}", "{!! $password !!}", 1, "ch");

        }

        function calloutLogin(response) {
            if (response.errorCode) {
                alert("Login failed. " + response.playerMessage + " Error code: " + response.errorCode);
            }else{
                askTempandLaunchGame();
            }
        }

        function getUrlVars() {
            var vars = {};
            var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
                vars[key] = value;
            });
            return vars;

        }
        iapiSetCallout('GetTemporaryAuthenticationToken', calloutGetTemporaryAuthenticationToken);

        function askTempandLaunchGame() {
            currentgame = "{!! $gamecode !!}";
            gametype = "ngm";
            var realMode = 1;

            iapiRequestTemporaryToken(realMode, '424', 'GamePlay');
        }

        function launchMobileClient(temptoken) {

            var clientUrl = "https://hub.ld176888.com/igaming?gameId={!! $gamecode !!}&real=1&username={!! $accountUserName !!}&lang=ch&tempToken=" + temptoken ;

            document.location = clientUrl;
        }


        function calloutGetTemporaryAuthenticationToken(response) {
            if (response.errorCode) {
                alert("Token failed. " + response.playerMessage + " Error code: " + response.errorCode);
            }
            else {
                launchMobileClient(response.sessionToken.sessionToken);
            }
        }

        function Logout(){
            window.location = "index.html";
        }
        function load(){
            login();

        }
    </script>
</head>
<body onload="load()">

</body>
</html>